package com.demo.tool;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description: 发送数据
 * @Author: cyj
 * @Date: 2025-03-24 00:16:04
 */
@Slf4j
public class HttpUtilWrapper {

    public static String sendPostRequest(String url, JSONObject data) {
        try {
            String response = HttpUtil.post(url, data.toJSONString());
            log.info(response);
            return response;
        } catch (Exception e) {
            log.error("发送POST请求失败", e);
            throw new RuntimeException("发送POST请求失败", e);
        }
    }
}
